top.useDruggy = true;  // incase combat assistant is installed and this is not installed.

function druggySave(numDrugs) { 
	// get current values of overdrug and zeroDrugTime and drugTickTime
	var overdrug = Number(localStorage.getItem ('po_druggy_overdrug'));
	var zeroDrugTime = Number(localStorage.getItem ('po_druggy_zeroDrugTime'));
	var drugTickTime = Number(localStorage.getItem ('po_druggy_tick'));
	
	// Make sure they are valid
	if (overdrug==null)	overdrug = 0;
	if (zeroDrugTime==null)	zeroDrugTime = 0;
    if (drugTickTime==null)	drugTickTime=3600;  // default to 1 hour
		
	// If we are already drugged, just add to what we have, else brand new.
	if (overdrug>0) {
		overdrug = overdrug + Number(numDrugs);
		zeroDrugTime = zeroDrugTime + numDrugs*drugTickTime*1000;
	}
	else
	{	
		var curtime = new Date();
	
		overdrug = Number(numDrugs);
		zeroDrugTime = curtime.getTime() + numDrugs*drugTickTime*1000;
		
		if (overdrug<0) overdrug = 0;
	}
	//save overdrug, zeroDrugTime
	localStorage.setItem ('po_druggy_overdrug', overdrug);
	localStorage.setItem ('po_druggy_zeroDrugTime', zeroDrugTime);
}	